//
// Created by lihengliu on 2023/2/26.
//
#include "jni_float_util.h"
jclass JNIFloatUtil::createFloatClass(JNIEnv *env) {
    return env->FindClass("java/lang/Float");
}

jobject JNIFloatUtil::createFloatInstanceOfFloat(JNIEnv *env) {
    jclass class_float = createFloatClass(env);
    jmethodID init_float = env->GetMethodID(class_float, "<init>", "(F)V");
    jobject obj_int = env->NewObject(class_float, init_float);
    return obj_int;
}

jobject JNIFloatUtil::createFloatInstanceOfFloat(JNIEnv *env, jclass class_int) {
    jmethodID init_float = env->GetMethodID(class_int, "<init>", "(F)V");
    jobject obj_float = env->NewObject(class_int, init_float);
    return obj_float;
}

jmethodID JNIFloatUtil::createFloatConstructorOfFloat(JNIEnv *env) {
    jclass class_float = createFloatClass(env);
    jmethodID init_float = env->GetMethodID(class_float, "<init>", "(F)V");
    return init_float;
}

jmethodID JNIFloatUtil::createFloatConstructorOfFloat(JNIEnv *env,jclass class_float) {
    jmethodID init_float = env->GetMethodID(class_float, "<init>", "(F)V");
    return init_float;
}

jmethodID JNIFloatUtil::createFloatFloatValueMethod(JNIEnv *env) {
    jclass class_float = createFloatClass(env);
    jmethodID method_float = env->GetMethodID(class_float, "floatValue", "()F");
    return method_float;
}

jmethodID JNIFloatUtil::createFloatFloatValueMethod(JNIEnv *env, jclass class_float) {
    jmethodID method_float = env->GetMethodID(class_float, "floatValue", "()F");
    return method_float;
}
